package com.happy3w.cmds.refactor.config;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

import java.util.regex.Pattern;

@Getter
@Setter
@Builder
@AllArgsConstructor
public class RegexCpiConfig implements ChangePackageItemConfig {
    // com\.abc\.(.*)\.bean\.(.*)ServiceImpl
    private Pattern from;

    // com.def.bean.$1.$2ServiceImpl
    private String to;

    @Override
    public String apply(String className) {
        return from.matcher(className).replaceAll(to);
    }
}
